// $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.alwaysOverridetoString.alwaysOverrideToString
/* Copyright (c) 2011 Team A CS2340. All rights reserved.*/

package edu.gatech.teama.doctorsoffice.client.presenter;


import edu.gatech.teama.doctorsoffice.client.view.LoginPanel;
import edu.gatech.teama.doctorsoffice.client.view.MainWindow;

import edu.gatech.teama.doctorsoffice.client.view.UserLookupPanel;
import edu.gatech.teama.doctorsoffice.model.*; // $codepro.audit.disable importStyle

/**
 * Presenter for the System Admin main pane.
 * 
 * @author TEAMA
 * @version 1.0
 */
public class SystemAdminMainPresenter {
	
	/**
	 * server connection
	 */
	private final ServerConnection sc;

	/**
	 * logged in User
	 */
	private SystemAdmin loggedUser;
	
	/**
	 * Default constructor, sets the server and logged in user
	 */
	public SystemAdminMainPresenter() {
		sc=ServerConnection.getInstance();

		loggedUser=(SystemAdmin) sc.getLoggedInUser();

	}
	
	/**
	 * @return the logged in user
	 */
	public SystemAdmin getUser() {
		return loggedUser;
	}

	/**
	 * log out user
	 */
	public void logOut() {
		loggedUser=null;
		sc.disconnect();
		MainWindow.setPanel(new LoginPanel());
	}

	/**
	 * get the look up panel
	 */
	public void lookup() {
		MainWindow.getFrame().setContentPane(new UserLookupPanel());
		MainWindow.getFrame().pack();
		
	}
}
